Audio playing method and device, storage medium and program product
By obtaining audio in the Android system and determining its corresponding audio playback device, and using the audio manager to establish a playback thread for the audio track, the mixing complexity problem when multiple applications play audio at the same time is solved, and the independent output of different audios is achieved, thereby improving audio playback efficiency and user experience.
Patent Information
- Application Number
- CN202410317589.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2025-09-19
AI Technical Summary
In the Android system, when multiple applications play audio at the same time, the existing technology cannot effectively output different audio to different audio playback devices, resulting in complex and inefficient mixing processing.
By obtaining multiple audios and determining their corresponding audio playback devices, they are sent to the corresponding audio playback devices respectively, and the audio manager is used to establish a playback thread for the audio track to achieve independent processing and output of the audio.
This enables different audio to be output to different audio playback devices, improving audio playback efficiency and user experience.
Smart Images

Figure CN120676288A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to an audio playback method, device, storage medium, and program product. Background Art
[0002] In the related technology, when multiple applications on a terminal device play audio at the same time, the Android system can generate multiple AudioTracks based on AOSP (Android Open Source Project) when multiple application software play audio at the same time. Then, in the audio manager (AudioFlinger), after mixing the multiple AudioTracks through AudioMix, the audio can be output to an audio playback device (such as one of headphones, speakers, etc.). Summary of the Invention
[0003] To overcome the problems existing in the related art, the present disclosure provides an audio playback method, device, storage medium and program product.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an audio playback method, comprising:
[0005] Acquire multiple audios, where the multiple audios are different from each other;
[0006] Determine an audio playback device corresponding to each of the multiple audios;
[0007] Each audio of the multiple audios is sent to a corresponding audio playback device.
[0008] Optionally, the multiple audios are audios output by multiple applications running in the terminal device.
[0009] The step of determining the audio playback device corresponding to each of the plurality of audios includes:
[0010] Acquiring playback relationship information, where the playback relationship information indicates a correspondence between a plurality of applications in the terminal device and a plurality of audio playback devices;
[0011] The corresponding relationship between the multiple audios and the multiple audio playback devices is determined according to the playback relationship information, where the corresponding relationship is used to represent the audio playback device corresponding to each audio in the multiple audios.
[0012] Optionally, the multiple applications correspond to multiple audio tracks respectively, and each audio track corresponds to an audio playback device.
[0013] The sending each of the multiple audios to the corresponding audio playback device includes:
[0014] Determine a first audio track corresponding to a first application, where the first application is an application that outputs a first audio, and the first audio is any audio among the multiple audios;
[0015] The first audio is sent to a first audio playback device, where the first audio playback device is an audio playback device corresponding to the first audio track among the multiple audio playback devices.
[0016] Optionally, before sending the first audio to the first audio playback device, the method further includes:
[0017] Establish corresponding playback threads for the multiple audio tracks respectively through the audio manager;
[0018] The sending the first audio to the first audio playback device includes:
[0019] The first audio is sent to the first audio playback device through a first playback thread, where the first playback thread is a playback thread corresponding to the first audio track.
[0020] Optionally, the method further includes:
[0021] When the first application stops outputting the first audio, the first playback thread is deleted through the audio manager.
[0022] Optionally, before sending the first audio to the first audio playback device, the method further includes:
[0023] Establishing corresponding playback threads for the multiple audio playback devices respectively through the audio manager;
[0024] The sending the first audio to the first audio playback device includes:
[0025] The first audio is sent to the first audio playback device through the first playback thread, and the first playback thread is a playback thread corresponding to the first audio playback device.
[0026] Optionally, the method further includes:
[0027] When the first audio playback device is disconnected from the terminal device, the first playback thread is deleted through the audio manager.
[0028] According to a second aspect of an embodiment of the present disclosure, there is provided an audio playback device, comprising:
[0029] An acquisition module is configured to acquire a plurality of audios, wherein the plurality of audios are different from each other;
[0030] A determination module is configured to determine an audio playback device corresponding to each of the multiple audios;
[0031] The control module is configured to send each of the multiple audios to a corresponding audio playback device.
[0032] According to a third aspect of an embodiment of the present disclosure, there is provided an audio playback device, comprising:
[0033] processor;
[0034] a memory for storing processor-executable instructions;
[0035] The processor is configured to: execute the executable instructions to implement the steps of the audio playback method provided in the first aspect of the present disclosure.
[0036] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the audio playback method provided in the first aspect of the present disclosure are implemented.
[0037] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of the audio playback method provided in the first aspect of the present disclosure.
[0038] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:
[0039] In the above technical solution, multiple audio tracks are obtained, each of which is different from the other; the audio playback device corresponding to each of the multiple audio tracks is determined; and each of the multiple audio tracks is sent to the corresponding audio playback device. Through the above method, when a terminal device plays multiple audio tracks, different audio tracks can be output to different audio playback devices, allowing the multiple audio playback devices to play different audio tracks.
[0040] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0042] Figure 1 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0043] Figure 2 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0044] Figure 3 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0045] Figure 4 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0046] Figure 5 The figure is a schematic diagram showing an audio playback relationship according to an exemplary embodiment.
[0047] Figure 6 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0048] Figure 7 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0049] Figure 8 The figure is a schematic diagram showing an audio playback relationship according to an exemplary embodiment.
[0050] Figure 9 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0051] Figure 10 is a block diagram showing an audio playback device 1000 according to an exemplary embodiment.
[0052] Figure 11 is a block diagram of an audio playback device 1100 according to an exemplary embodiment.
[0053] Figure 12 is a block diagram of a vehicle 1200 according to an exemplary embodiment. DETAILED DESCRIPTION
[0054] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
[0055] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the corresponding data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
[0056] Figure 1 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 1 As shown, the following steps are included:
[0057] In step S11 , a plurality of audios are acquired, and the plurality of audios are different from each other.
[0058] Exemplarily, in the embodiments described in the present disclosure, a terminal device can be used to play and / or obtain audio. For example, the terminal device can be a mobile phone, a tablet computer, a smart speaker, a smart TV, a car terminal, a vehicle, or other devices with the function of playing audio. The terminal device can play multiple audios simultaneously through one or more installed applications. For example, it can play multiple audios through a music software, play the audio of multiple videos through a video software, and play audio 1 through music software, audio 2 through video software, and audio 3 through navigation software at the same time. In summary, the present disclosure does not limit the number of the multiple audios played and / or obtained by the terminal device.
[0059] In step S12, the audio playback device corresponding to each of the multiple audios is determined.
[0060] Exemplarily, in the embodiments described in the present disclosure, the audio playback device is a device that can be used to play audio sent by a terminal device. For example, the multiple audio playback devices can be multiple headphones, speakers, and / or speakers connected to the terminal device. Each of the multiple audios corresponds to a different audio playback device, that is, the multiple audios correspond one-to-one to multiple different audio playback devices. In addition, when the multiple audios and / or the multiple audio playback devices change, for example, an audio playback device is disconnected from the terminal device, or an audio playback device is newly connected to the terminal device and is set to play a new audio (the new audio can be understood as other audio in addition to the above-mentioned multiple audios, such as the audio of a newly opened application), the terminal device can update the corresponding relationship.
[0061] In step S13, each of the multiple audios is sent to a corresponding audio playback device.
[0062] For example, the terminal device can be a mobile phone, and the multiple audio playback devices are respectively the speaker of the terminal device, the Bluetooth headset connected to the terminal device, and the speaker connected to the terminal device. The audio played through the mobile phone includes audio 1, audio 2 and audio 3, among which the audio playback device corresponding to audio 1 is the speaker, the audio playback device corresponding to audio 2 is the speaker, and the audio playback device corresponding to audio 3 is the Bluetooth headset. At a certain moment, the terminal device plays audio 1 through the first application, plays audio 2 through the second application, and plays audio 3 through the third application. At this time, audio 2 can be sent to the speaker through the terminal device to enable the speaker to play audio 2; audio 3 can be sent to the Bluetooth headset through the terminal device to enable the Bluetooth headset to play audio 3; audio 1 can be sent to the speaker through the terminal device to enable the speaker to play audio 1.
[0063] For example, the terminal device may be a multimedia device of a vehicle, which may be provided with multiple speakers, which may be arranged in different positions in the vehicle, such as a driver's seat speaker and a passenger seat speaker, and there may also be headphones connected to the multimedia device inside the vehicle; at a certain moment, the vehicle plays navigation audio through navigation software, plays music through music software, and plays video through video software. At this time, when the audio playback device corresponding to the navigation audio is the driver's seat speaker, the navigation audio can be sent to the driver's seat speaker through the vehicle to enable the driver's seat speaker to play the navigation audio; when the audio playback device corresponding to the music audio is the headphone, the music audio can be sent to the headphone through the vehicle to enable the headphone to play the music audio; when the audio playback device corresponding to the video audio is the passenger seat speaker, the video audio can be sent to the passenger seat speaker through the vehicle to enable the passenger seat speaker to play the video audio.
[0064] It is understandable that the embodiments of the present disclosure do not limit the number of audio playback devices connected to the terminal device, the number of audios played by the terminal device, or the correspondence between the played audio and the terminal device.
[0065] In the above technical solution, multiple audio tracks are obtained, each of which is different from the other; the audio playback device corresponding to each of the multiple audio tracks is determined; and each of the multiple audio tracks is sent to the corresponding audio playback device. Through the above method, when a terminal device plays multiple audio tracks, different audio tracks can be output to different audio playback devices, allowing the multiple audio playback devices to play different audio tracks.
[0066] Figure 2 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 2 As shown, the multiple audios are audios output by multiple applications running in the terminal device, and step S12 includes the following steps:
[0067] In step S121, playback relationship information is obtained, where the playback relationship information indicates a corresponding relationship between multiple application programs and multiple audio playback devices in the terminal device.
[0068] Exemplarily, the one-to-one correspondence between multiple audios and multiple different audio playback devices can be generated through a big data model based on user habits. For example, when the terminal device is a mobile phone, when the mobile phone detects that the user has returned home, the music software in the mobile phone can be matched with the speaker, the video software can be matched with the projection device, and so on.
[0069] Optionally, in a possible implementation manner, the acquiring the playback relationship information includes: receiving the playback relationship information through a user interface of the terminal device.
[0070] For example, when any audio playback device establishes a connection with a terminal device, the user of the terminal device can establish a playback relationship between the audio playback device and an application in the terminal device in the display interface of the terminal device. For example, the terminal device may have a settings interface dedicated to setting the playback relationship between the audio playback device and the application. The user can manually open the settings interface, or the terminal device may automatically open the settings interface when it detects that the terminal device is connected to a new audio playback device or detects that the terminal device has opened a new application with an audio playback function, wherein the new application can be understood as a newly installed application or an application that is not currently playing audio. The automatic opening of the settings interface includes automatically jumping to the settings interface or automatically popping up a window to remind the user whether to enter the settings interface.
[0071] Alternatively, in another possible implementation, when any audio playback device establishes a connection with a terminal device, a playback relationship may be established between the audio playback device and the first audio playback application opened by the terminal device after the connection is established. It will be appreciated that when multiple audio playback devices establish connections with the terminal device in succession, playback relationships may be established between the multiple audio playback applications opened by the terminal device after the multiple connections are established and the multiple audio playback devices, respectively, in the order in which the multiple connections were established. For example, after the audio playback device 1 is connected to the terminal device (it can also be set to within a certain time after being connected to the terminal device), if the terminal device opens application 1 that can play audio, a playback relationship between application 1 and the audio playback device 1 can be established; if the terminal device opens application 2 that can play audio, a playback relationship between application 1 and the audio playback device 2 can be established; or, it is also possible to establish a playback relationship between multiple audio playback devices and multiple applications at one time after continuously adding devices, such as when audio playback device 1, audio playback device 2, and audio playback device 3 are continuously connected to the terminal device, and the terminal device continuously opens application 1, application 2, and application 3 that can play audio, a playback relationship between application 1 and audio playback device 1, a playback relationship between application 2 and audio playback device 2, and a playback relationship between application 3 and audio playback device 3 can be established respectively.
[0072] Alternatively, in another possible implementation, when the terminal device opens any application that can play audio, the first audio playback device connected to the terminal device after the application is opened can establish a playback relationship with the application. It is understandable that when the terminal device opens multiple applications that can play audio in succession, the multiple audio playback devices connected to the terminal device after the multiple applications are opened can establish playback relationships with the multiple applications respectively in the order in which the multiple applications are opened. For example, after the terminal device opens application 1 that can play audio (it can also be set to within a certain time after the terminal device opens application 1), if audio playback device 1 is connected to the terminal device, a playback relationship between application 1 and audio playback device 1 can be established; if audio playback device 2 is connected to the terminal device, a playback relationship between application 1 and audio playback device 2 can be established. Alternatively, you can also continuously open multiple applications that can play audio and then establish playback relationships between multiple audio playback devices and multiple applications at one time. For example, when the terminal device continuously opens application 1, application 2, and application 3 that can play audio, when audio playback device 1, audio playback device 2, and audio playback device 3 are respectively connected to the terminal device, the playback relationship between application 1 and audio playback device 1, the playback relationship between application 2 and audio playback device 2, and the playback relationship between application 3 and audio playback device 3 can be established respectively.
[0073] In step S122 , a correspondence between the multiple audios and the multiple audio playback devices is determined according to the playback relationship information. The correspondence is used to represent the audio playback device corresponding to each audio in the multiple audios.
[0074] For example, after determining the playback relationship between the application and the audio playback device, the corresponding relationship between the audio played by any application and the audio playback device corresponding to the application can be determined.
[0075] Figure 3 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 3 As shown, the multiple applications correspond to multiple audio tracks respectively, and each audio track corresponds to an audio playback device. Step S13 includes the following steps:
[0076] In step S131 , a first audio track corresponding to a first application is determined. The first application is an application that outputs a first audio, and the first audio is any one of the multiple audios.
[0077] In step S132, the first audio is sent to a first audio playback device, where the first audio playback device is an audio playback device corresponding to the first audio track among the multiple audio playback devices.
[0078] For example, taking the Android system as an example, when any application plays audio, the terminal device can generate an audio track (AudioTrack) for the application to play the audio, send the audio track to the audio playback device corresponding to the audio, and play the audio track when the audio playback device receives the audio track. In addition, after sending the audio track to the audio playback device corresponding to the audio, the terminal device can also process the audio track, such as separating the audio track into channels such as left channel, right channel, center channel, etc., and processing each channel separately to achieve better sound effects; or, processing the audio track through different audio effectors, such as equalizer, compression, reverberation, etc. In addition, the playback speed and pitch of the audio track can also be adjusted.
[0079] Figure 4 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 4 As shown, before step S132, the method further includes the following steps:
[0080] In step S133, corresponding playback threads are respectively established for the multiple audio tracks through the audio manager.
[0081] Exemplarily, taking the Android system as an example, the playback thread can be playbackThread, and multi-threading is used to enable the terminal device to process multiple tasks at the same time; therefore, when the terminal device plays multiple audios at the same time, the audio manager of the terminal device can establish corresponding playback threads for the audio tracks of each audio corresponding to the multiple audios, and the multiple playback threads are respectively used to process and / or transmit the audio tracks corresponding to their respective threads. It can be understood that the audio manager can establish a playback thread corresponding to any application software that plays audio when the terminal device opens the application software; or, the audio manager can establish a playback thread corresponding to any audio among the multiple audios played by the terminal device after generating the corresponding audio track. In summary, in the terminal device, there is a one-to-one correspondence between the application software and the audio track, and a one-to-one correspondence between the audio track and the playback thread. Therefore, there is also a one-to-one correspondence between the application software and the playback thread.
[0082] Optionally, step S132 includes the following steps:
[0083] In step S1321, the first audio is sent to the first audio playback device through a first playback thread, where the first playback thread is a playback thread corresponding to the first audio track.
[0084] Exemplarily, if a playback thread corresponding to any one of the multiple audio tracks is successfully established, the audio track can be sent to the playback thread, and the playback thread can send the audio track to the corresponding audio playback device after processing the audio track.
[0085] For example, in a possible embodiment, when the operating system of the terminal device is an Android system, Figure 5As shown, the terminal device includes application 1, application 2, and application 3, and audio playback device 1, audio playback device 2, and audio playback device 3 are respectively connected to the terminal device, and the playback relationship between the three applications and the three audio playback devices is: audio playback device 1 is used to play the audio of application 1, audio playback device 2 is used to play the audio of application 2, and audio playback device 3 is used to play the audio of application 3. In the Android system, the audio manager of the terminal device is AudioFlinger, and AudioFlinger includes AudioMix. Among them, AudioFlinger is the core of the Android audio system and is also a system service used to manage audio input and output, process audio data, and schedule audio tasks. AudioMix is an important component in AudioFlinger, which is responsible for audio mixing and processing (such as adjusting volume, adding sound effects, etc.). When the terminal device opens application 1 or generates the audio track AudioTrack_1 corresponding to application 1, a playback thread PlaybackThread_1 corresponding to both application 1 and AudioTrack_1 can be established in AudioFlinger. The PlaybackThread_1 is used to process the AudioTrack_1 through AudioFlinger and AudioMix, and send the processed AudioTrack_1 to the audio playback device 1, so that the audio playback device 1 plays the audio of application 1. When the terminal device opens application 2 or generates the audio track AudioTrack_2 corresponding to application 2, a playback thread PlaybackThread_2 corresponding to both application 2 and AudioTrack_2 can be established in AudioFlinger. The PlaybackThread_2 is used to process the AudioTrack_2 through AudioFlinger and AudioMix, and send the processed AudioTrack_2 to the audio playback device 2, so that the audio playback device 2 plays the audio of application 2. When the terminal device opens application 3 or generates the audio track AudioTrack_3 corresponding to application 3, a playback thread PlaybackThread_3 corresponding to both application 3 and AudioTrack_3 can be established in AudioFlinger. The PlaybackThread_3 is used to process the AudioTrack_3 through AudioFlinger and AudioMix, and send the processed AudioTrack_3 to the audio playback device 3 so that the audio playback device 3 plays the audio of application 3.
[0086] Furthermore, when the user of the terminal device changes the playback relationship between application 1, application 2, and application 3, and audio playback device 1, audio playback device 2, and audio playback device 3 to: audio playback device 1 is used to play the audio of application 3, audio playback device 2 is used to play the audio of application 1, and audio playback device 3 is used to play the audio of application 2, then AudioTrack_1 processed by AudioFlinger and AudioMix can be sent to audio playback device 2 via PlaybackThread_1, so that audio playback device 2 plays the audio of application 1. AudioTrack_2 processed by AudioFlinger and AudioMix can be sent to audio playback device 3 via PlaybackThread_2, so that audio playback device 3 plays the audio of application 2. AudioTrack_3 processed by AudioFlinger and AudioMix can be sent to audio playback device 1 via PlaybackThread_3, so that audio playback device 1 plays the audio of application 3.
[0087] In summary, there is a one-to-one correspondence between the multiple applications, the multiple audio tracks, and the multiple playback threads; there is a one-to-one correspondence between the multiple applications and the multiple audio playback devices, and the playback relationship can be changed. When the playback relationship is changed, the audio track corresponding to the application can be sent to the corresponding audio playback device through the playback thread corresponding to the application. Figure 5 As shown, PlaybackThread_1 can send the audio corresponding to application 1 to audio playback device 1, audio playback device 2, and audio playback device 3 respectively according to the playback relationship. This shows that when any audio-playing application on a terminal device is started or plays audio, a playback thread corresponding to the application can be established in advance. When the audio playback device corresponding to the application is connected to the terminal device, the audio track corresponding to the application is sent to the audio playback device through the established playback thread. This can save the time of establishing a playback thread for sending the audio track after the audio playback device is connected to the terminal device, thereby reducing the delay time of the audio playback device receiving the audio track and improving the user experience.
[0088] Figure 6 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 6 As shown, the method further includes the following steps:
[0089] In step S1322, when the first application stops outputting the first audio, the first playback thread is deleted through the audio manager.
[0090] For example, Figure 5 As shown, when the application 1 of the terminal device exits, the PlaybackThread_1 corresponding to the application 1 can be deleted through the audio manager, which can reduce the resource usage of the audio manager. In addition, when the terminal device pauses the audio played by the application 1, the PlaybackThread_1 corresponding to the application 1 can also be deleted, or when the application 1 does not resume playing the audio within a specified time, the PlaybackThread_1 corresponding to the application 1 can be deleted.
[0091] Figure 7 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 7 As shown, before step S132, the method further includes the following steps:
[0092] In step S134, corresponding playback threads are respectively established for the multiple audio playback devices through the audio manager.
[0093] Optionally, step S132 may include the following steps:
[0094] In step S1323, the first audio is sent to the first audio playback device through the first playback thread, and the first playback thread is the playback thread corresponding to the first audio playback device.
[0095] For example, using the Android system as an example, the playback thread can be playbackThread. When any audio playback device is connected to the terminal device, the audio manager can establish a corresponding playback thread for the audio playback device. This playback thread is used to send audio played by any application on the terminal device to the audio playback device. It is understood that the playback thread corresponding to the audio playback device can process and send audio played by any application on the terminal device based on the playback relationship, so that the audio playback device plays the audio of the corresponding application according to the playback relationship.
[0096] For example, in a possible embodiment, when the operating system of the terminal device is an Android system, Figure 8As shown, the terminal device includes application 1, application 2, and application 3. Audio playback device 1, audio playback device 2, and audio playback device 3 are respectively connected to the terminal device, and the playback relationships between the three applications and the three audio playback devices are: audio playback device 1 is used to play the audio of application 1, audio playback device 2 is used to play the audio of application 2, and audio playback device 3 is used to play the audio of application 3. When the audio playback device 1 is connected to the terminal device, a playback thread PlaybackThread_1 corresponding to the audio playback device 1 can be established in AudioFlinger. The PlaybackThread_1 is used to process the audio track AudioTrack_1 corresponding to the application 1 through AudioFlinger and AudioMix, and send the processed AudioTrack_1 to the audio playback device 1, so that the audio playback device 1 plays the audio of the application 1. When the audio playback device 2 is connected to the terminal device, a playback thread PlaybackThread_2 corresponding to the audio playback device 2 can be established in AudioFlinger. The PlaybackThread_2 is used to process the audio track AudioTrack_2 corresponding to the application 2 through AudioFlinger and AudioMix, and send the processed AudioTrack_2 to the audio playback device 2, so that the audio playback device 2 plays the audio of the application 2. When the audio playback device 3 is connected to the terminal device, a playback thread PlaybackThread_3 corresponding to the audio playback device 3 can be established in AudioFlinger. The PlaybackThread_3 is used to process the audio track AudioTrack_3 corresponding to the application 3 through AudioFlinger and AudioMix, and send the processed AudioTrack_3 to the audio playback device 3, so that the audio playback device 3 plays the audio of the application 3.
[0097] In addition, when the user of the terminal device changes the playback relationship between application 1, application 2, and application 3, and audio playback device 1, audio playback device 2, and audio playback device 3 to: audio playback device 1 is used to play the audio of application 3, audio playback device 2 is used to play the audio of application 1, and audio playback device 3 is used to play the audio of application 2, the audio track AudioTrack_3 corresponding to application 3 can be sent to PlaybackThread_1, and then PlaybackThread_1 will send the processed AudioTrack_3 through AudioFlinger and AudioMix to audio playback device 1, so that audio playback device 1 plays the audio of application 3. The audio track AudioTrack_1 corresponding to application 1 can be sent to PlaybackThread_2, and then PlaybackThread_2 will send the processed AudioTrack_1 through AudioFlinger and AudioMix to audio playback device 2, so that audio playback device 2 plays the audio of application 1. The audio track AudioTrack_2 corresponding to the application 2 can be sent to PlaybackThread_3, and then PlaybackThread_3 will send the AudioTrack_2 processed by AudioFlinger and AudioMix to the audio playback device 3, so that the audio playback device 3 plays the audio of the application 2.
[0098] To sum up, there is a one-to-one correspondence between the multiple applications and the multiple audio tracks; there is a one-to-one correspondence between the multiple playback threads and the multiple audio playback devices, and the multiple one-to-one correspondences cannot be changed; there is a one-to-one corresponding playback relationship between the multiple applications and the multiple audio playback devices, and the playback relationship can be changed. When the playback relationship is changed, the audio track corresponding to the application can be sent to the playback thread corresponding to the audio playback device according to the playback relationship, and the corresponding audio can be sent to the audio playback device according to the corresponding playback thread; that is, Figure 8As shown, the audio track AudioTrack_1 corresponding to application 1 can be sent to PlaybackThread_1, PlaybackThread_2 or PlaybackThread_3 according to the playback relationship. It can be seen that when any audio playback device is connected to the terminal device, a playback thread corresponding to the audio playback device can be established through the audio manager, and the number of playback threads in the audio manager is always equal to the number of audio playback devices connected to the terminal device. Therefore, when the number of audio playing applications is greater than the number of audio playback devices connected to the terminal device, the number of playback threads that need to be established in the audio manager can be reduced, thereby reducing the processing pressure of the audio manager and improving the performance of the audio manager.
[0099] Figure 9 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 9 As shown, the method further includes the following steps:
[0100] In step S1324, when the first audio playback device is disconnected from the terminal device, the first playback thread is deleted through the audio manager.
[0101] For example, Figure 8 As shown, when the audio playback device 3 is disconnected from the terminal device, the PlaybackThread_3 corresponding to the audio playback device 3 can be deleted through the audio manager, thereby reducing the resource usage of the audio manager.
[0102] In summary, in the embodiments of the present disclosure, the terminal device can also accept an operation instruction from any audio playback device connected to the terminal device and perform a corresponding operation according to the operation instruction; for example, in the embodiment of the present disclosure, the terminal device can also accept an operation instruction from any audio playback device connected to the terminal device and perform a corresponding operation according to the operation instruction; Figure 8 In the embodiment shown, when the application 1 is a music playback software and the audio playback device 1 plays the audio of the application 1, the terminal device can receive instructions such as the previous song, next song, pause playback, and start playback sent by the audio playback device 1. After the terminal device receives the instruction, the application 1 can perform operations such as the previous song, next song, pause playback, and start playback according to the content of the instruction.
[0103] In the above technical solution, multiple audio tracks are obtained, each of which is different from the other; the audio playback device corresponding to each of the multiple audio tracks is determined; and each of the multiple audio tracks is sent to the corresponding audio playback device. Through the above method, when a terminal device plays multiple audio tracks, different audio tracks can be output to different audio playback devices, allowing the multiple audio playback devices to play different audio tracks.
[0104] Optionally, in a possible embodiment, before step S132, the method may further include the following steps:
[0105] (1) obtaining mode indication information, where the mode indication information is used to indicate an audio playback mode of the terminal device;
[0106] (2) when the mode indication information indicates that the audio playback mode is the first mode, generating a target audio according to the multiple audios, and sending the target audio to a target audio playback device among the multiple audio playback devices;
[0107] (3) When the mode indication information indicates that the audio playback mode is the second mode, the multiple audios are sent to the multiple audio playback devices.
[0108] For example, in the embodiment described in the present disclosure, the audio playback mode of the terminal device includes a first mode and a second mode; before the terminal device plays audio, it is necessary to obtain mode indication information. When the audio playback mode indicated by the mode indication information is the first mode, and the terminal device plays multiple audios, a target audio can be generated based on the multiple audio mixing, and the target audio can be sent to at least one audio playback device among the multiple audio playback devices, or the target audio can be sent to a target audio playback device among the multiple audio playback devices for receiving the target audio. When the audio playback mode indicated by the mode indication information is the second mode, and the terminal device plays multiple audios, the multiple audios can be sent to the multiple audio playback devices based on the playback relationship. The specific method is similar to the method described in the above embodiment and will not be repeated here.
[0109] In the above technical solution, multiple audio tracks are obtained, each of which is different from the other; the audio playback device corresponding to each of the multiple audio tracks is determined; and each of the multiple audio tracks is sent to the corresponding audio playback device. Through the above method, when a terminal device plays multiple audio tracks, different audio tracks can be output to different audio playback devices, allowing the multiple audio playback devices to play different audio tracks.
[0110] Figure 10 FIG1 is a block diagram of an audio playback device 1100 according to an exemplary embodiment. Figure 10 The device includes: an acquisition module 1010, a determination module 1020 and a control module 1030.
[0111] The acquisition module 1010 is configured to acquire a plurality of audios, where the plurality of audios are different from each other;
[0112] The determining module 1020 is configured to determine the audio playback device corresponding to each audio in the plurality of audios;
[0113] The control module 1030 is configured to send each of the multiple audios to a corresponding audio playback device.
[0114] Optionally, the multiple audios are audios output by multiple applications running in the terminal device, and the control module 1030 includes: an acquisition submodule and a control submodule;
[0115] The acquisition submodule is configured to acquire playback relationship information, where the playback relationship information indicates a correspondence between multiple applications and multiple audio playback devices in the terminal device;
[0116] The control submodule is configured to determine a correspondence between the multiple audios and the multiple audio playback devices according to the playback relationship information, where the correspondence is used to represent the audio playback device corresponding to each audio in the multiple audios.
[0117] Optionally, the multiple applications correspond to multiple audio tracks respectively, each of the audio tracks corresponds to an audio playback device, and the control submodule is further configured to:
[0118] Determine a first audio track corresponding to a first application, where the first application is an application that outputs a first audio, and the first audio is any audio among the multiple audios;
[0119] The first audio is sent to a first audio playback device, where the first audio playback device is an audio playback device corresponding to the first audio track among the multiple audio playback devices.
[0120] Optionally, the control submodule is further configured to:
[0121] Before sending the first audio to the first audio playback device, establishing corresponding playback threads for the multiple audio tracks respectively through the audio manager;
[0122] The step of sending the first audio to the first audio playback device includes:
[0123] The first audio is sent to the first audio playback device through a first playback thread, where the first playback thread is a playback thread corresponding to the first audio track.
[0124] Optionally, the control submodule is further configured to:
[0125] Before sending the first audio to the first audio playback device, establishing corresponding playback threads for the multiple audio playback devices respectively through the audio manager;
[0126] The step of sending the first audio to the first audio playback device includes:
[0127] The first audio is sent to the first audio playback device through the first playback thread, and the first playback thread is the playback thread corresponding to the first audio playback device.
[0128] Optionally, the control submodule is further configured to delete the first playback thread through the audio manager when the first application stops outputting the first audio.
[0129] Optionally, the control submodule is further configured to delete the first playback thread through the audio manager when the first audio playback device is disconnected from the terminal device.
[0130] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0131] In the above technical solution, multiple audio tracks are obtained, each of which is different from the other; the audio playback device corresponding to each of the multiple audio tracks is determined; and each of the multiple audio tracks is sent to the corresponding audio playback device. Through the above method, when a terminal device plays multiple audio tracks, different audio tracks can be output to different audio playback devices, allowing the multiple audio playback devices to play different audio tracks.
[0132] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon. When the program instructions are executed by a processor, the steps of the audio playback method provided by the present disclosure are implemented.
[0133] Figure 11 1 is a block diagram illustrating an audio playback device 1100 according to an exemplary embodiment. For example, device 1100 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, in-vehicle terminal, or other electronic device for playing audio.
[0134] Reference Figure 11 The device 1100 may include one or more of the following components: a processing component 1102 , a memory 1104 , a power component 1106 , a multimedia component 1108 , an audio component 1110 , an input / output interface 1112 , a sensor component 1114 , and a communication component 1116 .
[0135] Processing component 1102 generally controls the overall operation of device 1100, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. Processing component 1102 may include one or more processors 1120 to execute instructions to perform all or part of the steps of the audio playback method described above. In addition, processing component 1102 may include one or more modules to facilitate interaction between processing component 1102 and other components. For example, processing component 1102 may include a multimedia module to facilitate interaction between multimedia component 1108 and processing component 1102.
[0136] The memory 1104 is configured to store various types of data to support the operation of the device 1100. Examples of such data include instructions for any application or method operating on the device 1100, contact data, phone book data, messages, pictures, videos, etc. The memory 1104 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0137] The power supply component 1106 provides power to the various components of the device 1100. The power supply component 1106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 1100.
[0138] The multimedia component 1108 includes a screen that provides an output interface between the device 1100 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1108 includes a front camera and / or a rear camera. When the device 1100 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
[0139] The audio component 1110 is configured to output and / or input audio signals. For example, the audio component 1110 includes a microphone (MIC) that is configured to receive external audio signals when the device 1100 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 1104 or transmitted via the communication component 1116. In some embodiments, the audio component 1110 also includes a speaker for outputting audio signals.
[0140] The input / output interface 1112 provides an interface between the processing component 1102 and peripheral interface modules, such as a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0141] Sensor assembly 1114 includes one or more sensors for providing various aspects of the status assessment of device 1100. For example, sensor assembly 1114 can detect the open / closed state of device 1100, the relative positioning of components, such as the display and keypad of device 1100. Sensor assembly 1114 can also detect changes in the position of device 1100 or a component of device 1100, the presence or absence of user contact with device 1100, the orientation or acceleration / deceleration of device 1100, and changes in the temperature of device 1100. Sensor assembly 1114 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1114 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1114 can also include an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0142] The communication component 1116 is configured to facilitate wired or wireless communication between the device 1100 and other devices. The device 1100 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1116 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1116 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0143] In an exemplary embodiment, the device 1100 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned audio playback method.
[0144] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1104 including instructions. The instructions can be executed by the processor 1120 of the device 1100 to perform the above-mentioned audio playback method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0145] In addition to being an independent electronic device, the above-mentioned device can also be a part of an independent electronic device. For example, in one embodiment, the device can be an integrated circuit (IC) or a chip, wherein the integrated circuit can be a single IC or a collection of multiple ICs; the chip can include but is not limited to the following types: GPU (Graphics Processing Unit), CPU (Central Processing Unit), FPGA (Field Programmable Gate Array), DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), SOC (System on Chip, SoC), etc. The above-mentioned integrated circuit or chip can be used to execute executable instructions (or codes) to implement the above-mentioned audio playback method. The executable instructions can be stored in the integrated circuit or chip, or can be obtained from other devices or equipment, for example, the integrated circuit or chip includes a processor, a memory, and an interface for communicating with other devices. The executable instruction can be stored in the memory, and when the executable instruction is executed by the processor, the above-mentioned audio playback method is implemented; alternatively, the integrated circuit or chip can receive the executable instruction through the interface and transmit it to the processor for execution to implement the above-mentioned audio playback method.
[0146] Figure 121 is a block diagram illustrating a vehicle 1200 according to an exemplary embodiment. For example, vehicle 1200 may be a hybrid vehicle, a non-hybrid vehicle, an electric vehicle, a fuel cell vehicle, or another type of vehicle. Vehicle 1200 may be an autonomous vehicle, a semi-autonomous vehicle, or a non-autonomous vehicle.
[0147] Reference Figure 12 Vehicle 1200 may include various subsystems, such as an infotainment system 1210, a perception system 1220, a decision-making and control system 1230, a drive system 1240, and a computing platform 1250. Vehicle 1200 may also include more or fewer subsystems, and each subsystem may include multiple components. Furthermore, each subsystem and each component of vehicle 1200 may be interconnected via wired or wireless means.
[0148] In some embodiments, the infotainment system 1210 may include a communication system, an entertainment system, a navigation system, and the like.
[0149] The perception system 1220 may include several sensors for sensing information about the environment surrounding the vehicle 1200. For example, the perception system 1220 may include a global positioning system (which may be a GPS system, a BeiDou system, or other positioning systems), an inertial measurement unit (IMU), a laser radar, a millimeter-wave radar, an ultrasonic radar, and a camera.
[0150] The decision control system 1230 may include a computing system, a vehicle controller, a steering system, a throttle, and a braking system.
[0151] Drive system 1240 may include components that provide power to vehicle 1200. In one embodiment, drive system 1240 may include an engine, a power source, a transmission system, and wheels. The engine may be an internal combustion engine, an electric motor, an air compression engine, or a combination thereof. The engine is capable of converting energy provided by the power source into mechanical energy.
[0152] Some or all functions of the vehicle 1200 are controlled by a computing platform 1250. The computing platform 1250 may include at least one processor 1251 and a memory 1252. The processor 1251 may execute instructions 1253 stored in the memory 1252.
[0153] The processor 1251 can be any conventional processor, such as a commercially available CPU. The processor can also include a graphics processor (GPU), a field programmable gate array (FPGA), a system on chip (SOC), an application specific integrated circuit (ASIC), or a combination thereof.
[0154] Memory 1252 can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0155] In addition to instructions 1253 , memory 1252 may also store data, such as road maps, route information, and vehicle location, direction, speed, etc. The data stored in memory 1252 may be used by computing platform 1250 .
[0156] In the embodiment of the present disclosure, the processor 1251 may execute the instruction 1253 to complete all or part of the steps of the above-mentioned audio playback method.
[0157] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above audio playback method when executed by the programmable device.
[0158] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the present disclosure. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0159] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An audio playback method, characterized in that: include: Acquire multiple audios, where the multiple audios are different from each other; Determine an audio playback device corresponding to each of the multiple audios; Each audio of the multiple audios is sent to a corresponding audio playback device.
2. The method according to claim 1, characterized in that The multiple audios are audios output by multiple applications running in the terminal device, The step of determining the audio playback device corresponding to each of the plurality of audios includes: Acquiring playback relationship information, where the playback relationship information indicates a correspondence between a plurality of applications in the terminal device and a plurality of audio playback devices; The corresponding relationship between the multiple audios and the multiple audio playback devices is determined according to the playback relationship information, where the corresponding relationship is used to represent the audio playback device corresponding to each audio in the multiple audios.
3. The method according to claim 2, characterized in that The multiple applications correspond to multiple audio tracks respectively, and each audio track corresponds to an audio playback device. The sending each of the multiple audios to the corresponding audio playback device includes: Determine a first audio track corresponding to a first application, where the first application is an application that outputs a first audio, and the first audio is any audio among the multiple audios; The first audio is sent to a first audio playback device, where the first audio playback device is an audio playback device corresponding to the first audio track among the multiple audio playback devices.
4. The method according to claim 3, characterized in that Before sending the first audio to the first audio playback device, the method further includes: Establish corresponding playback threads for the multiple audio tracks respectively through the audio manager; The sending the first audio to the first audio playback device includes: The first audio is sent to the first audio playback device through a first playback thread, where the first playback thread is a playback thread corresponding to the first audio track.
5. The method according to claim 4, characterized in that The method further comprises: When the first application stops outputting the first audio, the first playback thread is deleted through the audio manager.
6. The method according to claim 3, characterized in that Before sending the first audio to the first audio playback device, the method further includes: Establishing corresponding playback threads for the multiple audio playback devices respectively through the audio manager; The sending the first audio to the first audio playback device includes: The first audio is sent to the first audio playback device through the first playback thread, and the first playback thread is a playback thread corresponding to the first audio playback device.
7. The method according to claim 6, characterized in that The method further comprises: When the first audio playback device is disconnected from the terminal device, the first playback thread is deleted through the audio manager.
8. An audio playback device, characterized in that: include: An acquisition module is configured to acquire a plurality of audios, wherein the plurality of audios are different from each other; A determination module is configured to determine an audio playback device corresponding to each of the multiple audios; The control module is configured to send each of the multiple audios to a corresponding audio playback device.
9. An audio playback device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the steps of the method according to any one of claims 1 to 7 when executing the executable instructions.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.